package day02;

public class DataTypeCastDemo {
    public static void main(String[] args) {
        int a = 5;
        long b = a;
        int c = (int) b;
        double e = 5;
        System.out.println(e);
        long f = 100000000000L;
        int g = (int) f;
        System.out.println(g);//1215752192,强制有可能发生溢出
        double h = 24.987;
        int i = (int) h;
        System.out.println(i);
        byte arr1 = 100;
        byte arr2 = 50;
        byte arr3 = (byte) (arr1 + arr2);
        System.out.println("arr3值为" + arr3);//取值范围是 - 128 ~ 127 ，共 8 位，首位为符号位。
        // 比如计算中两个byte类型数值相加结果超出 127，就会溢出。如byte a = 100; byte b = 50; byte c = (byte)(a + b);
        // a + b结果为 150，超出byte范围，c实际存储的值会变成负数 。

    }
}
